<?php
$userlevel = $this->session->userdata('userlevel');
$adminid = $this->session->userdata('adminid');
echo $erreur;
$user = $user_level == 2 ? 'ADMIN' : 'USER';
?>

<div id="wrapper-content">

    <table class="titrepage" width="100%">
        <tr>
            <td >La liste des <?php echo $titre ?></td>
            <td align="right">Total | <?php echo $total ?> </td>
        </tr>
    </table>
    <div align="left" id="ajouter">
        <table>
            <tr>
                <?php if ($user_level == 2) {
                ?>
                    <td><a href="<?php echo site_url('admin/add_user' . '/' . '2') ?>">Ajouter nouveau administrateur</a></td>
                    <td><a href="<?php echo site_url('admin/list_user' . '/' . '3') ?>">La liste des utilisateurs</a></td>
<?php } else { ?>
                    <td><a href="<?php echo site_url('admin/add_user' . '/' . '3') ?>">Ajouter nouveau utilisateur</a></td>
                    <td><a href="<?php echo site_url('admin/list_user' . '/' . '2') ?>">La liste des administrateurs</a></td>
<?php } ?>
            </tr>
        </table>
    </div>
    <?php if($total>0){?>
    <table width="100%" class="list">
        <thead>
            <tr>
                <th>Email</th>
                <th>Identifiant</th>
                <th>Nom</th>
                <th>Prénom</th>
                <th colspan="3">Action</th>
            </tr>
        </thead>
<?php foreach ($query as $aRow): ?>
                    <tr>
                        <td><?php echo $aRow['email']; ?></td>
                        <td><?php echo $aRow['username']; ?></td>
                        <td><?php echo $aRow['first_name'] ?></td>
                        <td><?php echo $aRow['last_name'] ?></td>
<?php if ($user_level == 3) : ?>
                        <?php if($aRow['active']==1){?>
                        <td width="70px"><a  href="<?php echo site_url('admin/deactivate_user') . '/' . $aRow['id'] . '/' . $user_level; ?>" ><img border="0"src="<?php echo base_url() . 'assets/admin/' ?>images/active.png"/></a></td>
                        <?php }else{?>
                        <td width="70px"><a  href="<?php echo site_url('admin/activate_user') . '/' . $aRow['id'] . '/' . $user_level; ?>" ><img border="0"src="<?php echo base_url() . 'assets/admin/' ?>images/in-active.png"/></a></td>
                        <?php }?>
                        <td width="70px"><a  href="<?php echo site_url('admin/edit_profile') . '/' . $aRow['id'] . '/' . $user_level; ?>" ><img border="0"src="<?php echo base_url() . 'assets/admin/' ?>images/modifier.png"/></a></td>
<?php endif; ?>
                    <td width="70px">
                        <a class="supprimer" href="#" ><img border="0"src="<?php echo base_url() . 'assets/admin/' ?>images/supprimer.png"/></a>
                        <div style="display:none">
                    		    	Confirmer <br/>
                            <a href="<?php echo site_url('admin/delete_user') . '/' . $aRow['id'] . '/' . $user_level . '/' . $per_page . '/' . $off_set; ?>"> <img border="0"src="<?php echo base_url() . 'assets/admin/' ?>images/oui.png"/></a>
                    <a class="non" href="#" ><img  border="0"src="<?php echo base_url() . 'assets/admin/' ?>images/non.png"/></a>
                </div>

            </td>
        </tr>
<?php endforeach; ?>
                </table>
<?php echo $pagination; ?>
    <?php }else {?>
    <div align="center"> Aucun résultat </div>
    <?php }?>
</div>
<!--END wrapper-content-->
